<template>
  <el-card class="box-card">
  <div slot="header" class="card-heaer">
    <span style="line-height: 36px;">旅行不便-旅行延误报案信息</span> 
    <el-button type="danger" style="float:right" @click="delect"  v-if="newState=='新增'|| (newState=='待办任务' && isNewAdd)">删除</el-button>
  </div>
  
  <el-form ref="form" :model="fromlist[model].obj"  :rules.sync="modelrules" label-width="180px">
    
      <el-form-item label="旅行使用的交通工具:"  prop="RI_TRAVELDELAY_WAY">
 <el-input v-model="fromlist[model].obj.RI_TRAVELDELAY_WAY"  :disabled=" newState=='审核' || (newState=='追加' && !isNewAdd ) || (newState=='待办任务' && !newIsEditer )" style="float:left; width:200px; padding-left:5px"></el-input>  
  </el-form-item>
   <el-form-item label="航班号/车次号:"  prop="RI_TRAVELDELAY_NUMBER">
    <el-input v-model="fromlist[model].obj.RI_TRAVELDELAY_NUMBER"  :disabled=" newState=='审核' || (newState=='追加' && !isNewAdd ) || (newState=='待办任务' && !newIsEditer )" style="float:left; width:200px; padding-left:5px"></el-input>  
  </el-form-item>
  <el-form-item label="出发地:"  prop="RI_TRAVELDELAY_FROM">
    <el-input v-model="fromlist[model].obj.RI_TRAVELDELAY_FROM"  :disabled=" newState=='审核' || (newState=='追加' && !isNewAdd ) || (newState=='待办任务' && !newIsEditer )" style="float:left; width:200px; padding-left:5px"></el-input>  
  </el-form-item>
 <el-form-item label="目的地:"  prop="RI_TRAVELDELAY_TO">
    <el-input v-model="fromlist[model].obj.RI_TRAVELDELAY_TO"  :disabled=" newState=='审核' || (newState=='追加' && !isNewAdd ) || (newState=='待办任务' && !newIsEditer )" style="float:left; width:200px; padding-left:5px"></el-input>  
  </el-form-item>
  <el-form-item label="原定出发时间:"  prop="RI_TRAVELDELAY_PLANOUT">
       <el-date-picker
      v-model="fromlist[model].obj.RI_TRAVELDELAY_PLANOUT"
      type="datetime"
      :disabled=" newState=='审核' || (newState=='追加' && !isNewAdd ) || (newState=='待办任务' && !newIsEditer )"
      placeholder="选择日期时间">
    </el-date-picker>
    
  </el-form-item>
    <el-form-item label="原定到达时间:"  prop="RI_TRAVELDELAY_PLANARRIVE">
          <el-date-picker
      v-model="fromlist[model].obj.RI_TRAVELDELAY_PLANARRIVE"
      type="datetime"
      :disabled=" newState=='审核' || (newState=='追加' && !isNewAdd ) || (newState=='待办任务' && !newIsEditer )"
      placeholder="选择日期时间">
    </el-date-picker>
   
  </el-form-item><el-form-item label="实际出发时间:"  prop="RI_TRAVELDELAY_FACTOUT">
       <el-date-picker
      v-model="fromlist[model].obj.RI_TRAVELDELAY_FACTOUT"
      type="datetime"
      :disabled=" newState=='审核' || (newState=='追加' && !isNewAdd ) || (newState=='待办任务' && !newIsEditer )"
      placeholder="选择日期时间">
    </el-date-picker>
  
  </el-form-item>
    <el-form-item label="实际到达时间:"  prop="RI_TRAVELDELAY_FACTARRIVE">
          <el-date-picker
      v-model="fromlist[model].obj.RI_TRAVELDELAY_FACTARRIVE"
      type="datetime"
      :disabled=" newState=='审核' || (newState=='追加' && !isNewAdd ) || (newState=='待办任务' && !newIsEditer )"
      placeholder="选择日期时间">
    </el-date-picker>
  
  </el-form-item>
   <el-form-item label="旅行延误原因(详情描述)"  prop="RI_TRAVELDELAY_DETAILS">
    <el-input type="textarea" v-model="fromlist[model].obj.RI_TRAVELDELAY_DETAILS"  :disabled=" newState=='审核' || (newState=='追加' && !isNewAdd ) || (newState=='待办任务' && !newIsEditer )"></el-input>
</el-form-item>

<el-form-item label="审核:" v-if="newState=='审核'|| ( newState=='追加'&& !isNewAdd)">
    <el-select placeholder="审核" v-model="fromlist[model].obj.RI_TRAVELDELAY_STATE" :disabled=" (newState=='审核' && oldState!='需审核') || (newState=='追加' && !isNewAdd ) ">
        <el-option label="审核通过" value="审核通过"></el-option>
        <el-option label="退回重新填写" value="需修改"></el-option>
        <el-option label="拒赔" value="审核不通过"></el-option>
    </el-select>
</el-form-item>
<el-form-item label="拒赔原因:" v-if="fromlist[model].obj.RI_TRAVELDELAY_STATE=='审核不通过'">
    <el-input type="textarea" v-model="fromlist[model].obj.RI_TRAVELDELAY_WHY"   :disabled="newState!='审核'"></el-input>
</el-form-item>
<el-form-item label="修改原因:" v-if="fromlist[model].obj.RI_TRAVELDELAY_STATE=='需修改'">
    <el-input type="textarea" v-model="fromlist[model].obj.RI_TRAVELDELAY_WHY"   :disabled="newState!='审核'"></el-input>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
    import {
        mapState
    } from 'vuex';
    export default {
        data() {
            return {
                medical: this.$store.state.reportform.medical,
                showwhy: false,      
                 oldState: this.$store.state.reportform.fromlist[this.model].obj.RI_TRAVELDELAY_STATE,         
                hospatialList: [],
                issuccess: false //是否通过
            }
        },
        props: {
            //对象
          model:{
              type: Number,
                default: 0
           },
           //对象约束
           modelrules:{
                 type: Object,
                default: {}
           },
           //状态2.0 新增 追加 待办任务
        newState: {
            type: String,
            default: "新增"
        },
        //状态2.0 代办任务中是否是需修改的 默认是true
        newIsEditer: {
            type: Boolean,
            default: true
        },
        //状态2.0 追加中是否是新增 默认是false 可以编辑
        isNewAdd: {
            type: Boolean,
            default: false
        },       
           
            //是否是审核
            ischeck: {
                type: Boolean,
                default: false
            }
           
        },
       
        methods: {         
            // checkchange() {
            //     if (this.medical.RI_MEDICAL_STATE != "审核通过" && this.medical.RI_MEDICAL_STATE != "") {
            //         this.showwhy = true;
            //     } else {
            //         this.showwhy = false;
            //     }
            // },
            handleCurrentChange(val) {
                this.currentRow = val;
            
                if(val!=null&& val!={})
                 this.medical.RI_MEDICAL_HLNAME=val.RECOMMENDHOSPITAL_ID;
             
            },
             delect(){
          
                if (this.model !== -1) {
                    this.fromlist.splice(this.model, 1)
                }
            }
        },
        computed: mapState({
            // 箭头函数可使代码更简练
            // medical: state => state.reportform.medical,
            address: state => state.select.address,
            medicalrules: state => state.reportform.medicalrules,
             fromlist:state => state.reportform.fromlist
        }),
      
    }
</script>
